package com.neusoft.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.neusoft.bean.Admins;
import com.neusoft.db.DBFactory;
import com.neusoft.model.LoginValidate;

public class AdminLoginedServlet extends HttpServlet {
	
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doPost(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//通过request对象获取表单数据
		//用户名
		String strAdminName = request.getParameter("adminName");
		//密码
		String strAdminPsw = request.getParameter("adminPsw");
		System.out.println(strAdminName);
		System.out.println(strAdminPsw);
		if (new LoginValidate().loginValidate(strAdminName, strAdminPsw)) {
			request.getRequestDispatcher("Logined/logined.jsp").forward(request, response);
		} else {
			request.getRequestDispatcher("Logined/loginout.jsp").forward(request, response);
		}
		
		//跳转到视图页面进行结果显示
//		request.getRequestDispatcher("Logined/logined.jsp").forward(request, response);
	}
	
}
